package org.example.iris.mapper;

import org.apache.ibatis.annotations.*;
import org.example.iris.entity.InterviewSchedule;

import java.util.List;

@Mapper
public interface InterviewScheduleMapper {

    // 插入面试安排
    @Insert("INSERT INTO interview_schedule (student_id, company_id, date, time, location, result) " +
            "VALUES (#{studentId}, #{companyId}, #{date}, #{time}, #{location}, #{result})")
    int insertInterviewSchedule(@Param("studentId") int studentId,
                                @Param("companyId") int companyId,
                                @Param("date") String date,
                                @Param("time") String time,
                                @Param("location") String location,
                                @Param("result") String result);

    // 获取某学生的面试安排
    @Select("SELECT * FROM interview_schedule WHERE student_id = #{studentId}")
    List<InterviewSchedule> getInterviewSchedulesByStudentId(int studentId);

    // 获取某公司面试安排
    @Select("SELECT * FROM interview_schedule WHERE company_id = #{companyId}")
    List<InterviewSchedule> getInterviewSchedulesByCompanyId(int companyId);

    // 修改面试结果
    @Update("UPDATE interview_schedule SET result = #{result} WHERE interview_id = #{interviewId}")
    int updateInterviewResult(@Param("interviewId") int interviewId, @Param("result") String result);

    // 删除面试安排
    @Delete("DELETE FROM interview_schedule WHERE interview_id = #{interviewId}")
    int deleteInterviewSchedule(int interviewId);
}
